# 鸡兔同笼

foots = int(input())
heads = int(input())

rabbits = foots/2-heads
chicken = heads - rabbits

print(int(chicken))
print(int(rabbits))